<template>
  <div>
    <div>{{ $store.state.user.token }}</div>
    <div>{{ $store.state.setting.name }}</div>
    <div>{{ token }}{{ name }}</div>
    <button @click="test">阿思歌</button>
    <button @click="ttt">妲己</button>
    <button @click="updateToken">思思</button>
  </div>
</template>

<script>
import { createNamespacedHelpers, mapGetters, mapMutations } from "vuex";
const { mapMutations: mapMutation } = createNamespacedHelpers("user");
export default {
  computed: { ...mapGetters(["token", "name"]) },
  methods: {
    test() {
      this.$store.commit("user/updateToken"); // 直接调用方法
    },
    ...mapMutations(["user/updateToken"]),
    ttt() {
      this["user/updateToken"]();
    },
    ...mapMutation(["updateToken"]),
  },
};
</script>

<style></style>
